home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / EEV100R1.ARJ / TESTP2.PAS < prev    next >
Pascal/Delphi Source File  |  1992-01-03  |  886b  |  56 lines

  1. program TestP2;
  2.  
  3. { This is a simple test program I used for POSTFIX.PAS }
  4.  
  5. Uses
  6.  
  7.   crt,
  8.   postfix;
  9.  
  10. var
  11.  
  12.   MyReal : real;
  13.   MyExpr : string;
  14.   MyErr,
  15.   MyBool : boolean;
  16.   MyAddr : Str20;
  17.  
  18. begin
  19.  
  20.   {init test variables}
  21.   MyErr := false;
  22.   MyBool := false;
  23.   MyReal := 0;
  24.  
  25.   while not MyBool do begin
  26.  
  27.     clrscr;
  28.     writeln('Postfix expression evaluator');
  29.     writeln('Enter empty expression to exit');
  30.     writeln;
  31.     writeln('Last result = ',MyReal);
  32.     writeln;
  33.     write('Expression: ');
  34.     readln(MyExpr);
  35.  
  36.     if MyExpr <> '' then begin
  37.  
  38.       Calculate(MyExpr,MyReal,MyErr);
  39.  
  40.       if MyErr then
  41.         {couldn't find variable - this is leftover from testing w/o TD}
  42.         MyReal := -99999;
  43.  
  44.     end
  45.     else
  46.       MyBool := true;
  47.  
  48.  
  49.   end; {while}
  50.  
  51.  
  52.   {deallocate linked list's memory}
  53.   DestroyList;
  54.  
  55. end. {TestI}
  56.